/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */



package com;

import java.io.*;
import java.util.*;
import javax.comm.*;


public class Main {


    public static void main(String[] args) {
        Scanner input;
        while(true){
            input=new Scanner(System.in);
        String doIt = input.nextLine();
        if(doIt.equals("")){getPorts();}
 else{System.out.println("");}

        // TODO code application logic here
    }

    }
    static public void getPorts(){

        String wantedPortName="COM";

        Enumeration portIdentifiers = CommPortIdentifier.getPortIdentifiers();

        CommPortIdentifier portId=null;
        while(portIdentifiers.hasMoreElements()){
            CommPortIdentifier pid = (CommPortIdentifier)portIdentifiers.nextElement();
            System.out.println(pid.getName());
            if(pid.getPortType()==CommPortIdentifier.PORT_SERIAL && pid.getName().equals(wantedPortName)){
                portId=pid;
                break;

            }

        }




    }

}
